﻿<!doctype html>
 <html >
 <head>
   <meta charset="UTF-8">
   <link rel="stylesheet" href="../../../css/common.css">
   <link rel="stylesheet" href="../../../css/main.css">
   <script type="text/javascript" src="../../../js/jquery.min.js"></script>
   <script type="text/javascript" src="../../../js/colResizable-1.3.min.js"></script>
   <script type="text/javascript" src="../../../js/common.js"></script>
</head>

<body>
  <div id="forms" class="mt10">
        <div class="box">
          <div class="box_border">
            <div class="box_top"><b class="pl15">添加通告</b></div>
            <div class="box_center">
              <form action="/annunciateadd" class="jqtransform" method="post">
               <table class="form_table pt15 pb15" width="100%" border="0" cellpadding="0" cellspacing="0">
                 <tr>
                  <td class="td_right">标题：</td>
                  <td class=""> 
                    <input type="text" name="annName" class="input-text lh30" size="40" required>
                  </td>
				  </tr>
				  <tr>
                  <td class="td_right">显示时间段：</td>
				  <td><input type="date" name="startTime" class="input-text lh30" size="40" required>to
				  <input type="date" name="endTime" class="input-text lh30" size="40" required></td>
                </tr>
					   <tr>
						  <td class="td_right">发布时间：</td>
						  <td class=""> 
							<input type="text" name="publishTime" class="input-text lh30" size="40" readonly>
						  </td>
					  </tr>
					   <tr>
						  <td class="td_right">发布人：</td>
						  <td class="">
                              <input type="text" name="realName" value="${user.realName}" readonly>
						  </td>
					  </tr>
					   <tr>
						  <td class="td_right">内容：</td>
						  <td class=""> 
							<textarea class="input-text lh30" name="publishContent" required></textarea>
						  </td>
					  </tr>
			
              
                 <tr>
                   <td class="td_right">&nbsp;</td>
                   <td class="">
				   <input type="submit" name="button" class="btn btn82 btn_save2" value="发布">
                     <input type="submit" name="button" class="btn btn82 btn_save2" value="保存"> 
                    <input type="button" name="button" class="btn btn82 btn_res" onclick="location.href='javascript:history.go(-1)'" value="返回"> 
                   </td>
                 </tr>
               </table>
               </form>
            </div>
          </div>
        </div>
     </div>
   </div> 
</body>
 <script type="text/javascript">
     //校验起始结束时间
     $(function () {
         $("[name='endTime']").blur(function () {
             var endTime = $(this).val();
             var startTime = $("[name='startTime']").val();

             if (startTime==null||startTime=='') {
                 alert("请填写起始时间！");
                 return;
             }
             if (endTime==null||endTime=='') {
                 alert("请填写结束时间！");
                 return;
             }
             if(startTime>endTime){
                 alert("憨批！写错了重写！")
                 $(this).val("");
                 $("[name='startTime']").val("");
                 return;
             }

             if(startTime!=null&&startTime!=''&&endTime!=null&&endTime!=''){
                 alert("进来了！！");
                 $("[name='publishTime']").val(startTime);
             }
         })

         //校验发布时间
         $("[name='publishTime']").blur(function () {
            var publishTime=$(this).val();
             var startTime = $("[name='startTime']").val();
             var endTime = $("[name='endTime']").val();
            if(publishTime<startTime||publishTime>endTime){
                alert("憨批！时间段不对")
                $(this).val("");
            }
         })
     })
 </script>
</html>